Skip to content

stash it#2

Open
JackDoan wants to merge 1 commit into
cachefrom
cache-jack
Open

stash it#2
JackDoan wants to merge 1 commit into
cachefrom
cache-jack

Conversation

@JackDoan

@JackDoan JackDoan commented Jul 1, 2026

Copy link
Copy Markdown

No description provided.

johnmaguire added a commit that referenced this pull request Jul 1, 2026
…hange)

On a client-side-cache miss, the goroutine that performed the fetch is handed
the raw server reply, not the stored entry, so a CachePut right after the miss
wrote to a nil stash and was dropped -- the caller then re-parsed the same
response on the very next hit (one wasted decode per fill).

pipe.go now allocates one cacheStash per fill and shares its pointer between the
copy stored in the entry and the reply returned to the fetcher, so CachePut
lands and later hits read it. Update() keeps a pre-seeded stash instead of
reallocating (composes with PR #2's guard); the CacheStore interface is
unchanged.

Adds TestClientSideCachingStashSurvivesMiss (fails without the pipe seeding),
which also asserts a refill after invalidation starts with a fresh stash.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant